package com.smartcaliper.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.smartcaliper.R;


/**
 * Created by censen on 2016/4/10.
 */
public class TitleView extends RelativeLayout {
    private ImageView back_tv;
    private TextView title_tv;
    private TextView menu_tv;
    public TitleView(Context context) {
        super(context,null);
    }

    public TitleView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        findView();
    }

    private void findView(){
        back_tv = (ImageView) findViewById(R.id.back);
        title_tv = (TextView) findViewById(R.id.title);
        menu_tv = (TextView) findViewById(R.id.menu);

    }

    public void setBackListener(OnClickListener listener){
        back_tv.setOnClickListener(listener);
    }

    public void setMenuListener(OnClickListener listener){
        menu_tv.setOnClickListener(listener);
    }

    public void setBackBtnVisible(int visible){
        back_tv.setVisibility(visible);
    }

    public void setMenuBtnVisible(int visible){
        menu_tv.setVisibility(visible);
    }

    public void setMenuBtnBackgourndResource(int resId){
        menu_tv.setBackgroundResource(resId);
    }

    public void setMenuBtnText(String text){
        menu_tv.setText(text);
    }

    public void setTitle(String title){
        title_tv.setText(title);
    }

    public void setTitleColor(int  color){
        title_tv.setTextColor(getResources().getColor(color));
    }




}
